﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using BCCommon;
using BCDto.OA.Workflow.Template.WorkflowActivity;
using BCService.OA.Workflow.Template.WorkflowActivity;

namespace BlackCoffeeRESTful.Controllers.Management.OA.Workflow.Template
{
    /// <summary>
    /// 工作流活动模板操作
    /// </summary>
    [ApiExplorerSettings(GroupName = "OAAdmin")]
    [Route("api/v1/sim/[controller]")]
    public class WorkflowActivityController : ManagementBaseController
    {
        private readonly IWorkflowActivityService workflowActivityService;

        public WorkflowActivityController(IWorkflowActivityService workflowActivityService)
        {
            this.workflowActivityService = workflowActivityService;
        }

        /// <summary>
        /// 获取工作流活动模板列表
        /// </summary>
        /// <param name="workflowCategoryId">工作流分类Id</param>
        /// <param name="workflowName">工作流名称</param>
        /// <param name="isBaseWorkflow">是否为基础工作流</param>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="pageSize">每页数据条数</param>
        /// <response code="200">获取工作流活动模板列表。</response>
        /// <returns></returns>
        [HttpGet("[action]")]
        [ProducesResponseType(typeof(PageableList<WorkflowActivityDto>), 200)]
        public IActionResult Query([FromQuery(Name = "workflow_category_id")]long? workflowCategoryId,
            [FromQuery(Name = "workflow_name")] string workflowName,
            [FromQuery(Name = "is_base_workflow")] bool? isBaseWorkflow,
            [FromQuery(Name = "page_index")] int pageIndex = 1,
            [FromQuery(Name = "page_size")] int pageSize = 10)
        {
            return Ok(this.workflowActivityService.Query(workflowCategoryId, workflowName, isBaseWorkflow, pageIndex, pageSize));
        }
    }
}
